﻿<UserControl x:Class="mediaPrime.Plugin.SystemManagement.UserControls.SettingsUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:mediaPrime.Plugin.SystemManagement.UserControls"
             xmlns:controls="clr-namespace:mediaPrime.Controls;assembly=mediaPrime.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <local:DisplayNameConverter x:Key="displayNameConverter"></local:DisplayNameConverter>
        <DataTemplate x:Key="defaultTemplate">
            <local:SettingUserControl>
                <TextBlock  Margin="16,0" VerticalAlignment="Center" Text="{Binding ., Converter={StaticResource displayNameConverter}}"></TextBlock>
            </local:SettingUserControl>
        </DataTemplate>
      
        <DataTemplate x:Key="boolTemplate">
            <local:SettingUserControl>
                <controls:MPCheckBox Foreground="White" BorderBrush="White" IsChecked="{Binding ConvertedValue}"></controls:MPCheckBox>
            </local:SettingUserControl>
        </DataTemplate>       
        
        <DataTemplate x:Key="enumTemplate">
            <local:SettingUserControl >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Border>
                <TextBlock   VerticalAlignment="Center" Text="{Binding ConvertedValue.Text}"></TextBlock>
                    </Border>
                    <StackPanel VerticalAlignment="Center" Margin="16,2,16,0" Grid.Column="1">
                        <Path Data="M167.5,212.46L199.5,177.507 231.5,212.46 167.5,212.46z" Stretch="Uniform" Fill="#FFFFFFFF" Width="12" Height="12" Margin="0,0,0,2" RenderTransformOrigin="0.5,0.5">
                            
                        </Path>
                        <Path Data="M454.165,177.507L422.165,212.46 390.165,177.507 454.165,177.507z" Stretch="Uniform" Fill="#FFFFFFFF" Width="12" Height="12" Margin="0,2,0,0" RenderTransformOrigin="0.5,0.5">
                           
                        </Path>
                    </StackPanel>
                </Grid>
                
            </local:SettingUserControl>
        </DataTemplate>
      
        <DataTemplate x:Key="emptyTemplate">
            <TextBlock Foreground="Gray" Text="No setting available!"></TextBlock>
        </DataTemplate>
   

        <local:SettingsDataTemplateSelector 
            BoolTemplate="{StaticResource boolTemplate}" 
         
            DefaultTemplate="{StaticResource defaultTemplate}"
      
            EmptyTemplate="{StaticResource emptyTemplate}"
            EnumTemplate="{StaticResource enumTemplate}"
                   
          
            x:Key="dataTemplateSelector"></local:SettingsDataTemplateSelector>
    </UserControl.Resources>
    <Grid>
        <controls:MPListBox ItemClicked="listBoxSettings_ItemClicked" Margin="16" x:Name="listBoxSettings" ItemTemplateSelector="{StaticResource dataTemplateSelector}"></controls:MPListBox>  
    </Grid>
</UserControl>
